//Mon 04 Jan 2010 10:29:52 AM CST 
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class TheTriangleBothDivs
{
public:
	string fix(string time)
	{
		int ans = 50;
		for(int h=0; h<24; h++)
		{
			for(int tz=-9; tz<=9; tz++)
			{
				//cout << ans << endl;
				if(time[0]!='?' && time[0]!='0'+(h/10)) continue;
				if(time[1]!='?' && time[1]!='0'+(h%10)) continue;
				if(time[9]!='?' && time[9]!=((tz<0) ? '-':'+')) continue;
				if(time[10]!='?' && time[10]!='0'+abs(tz)) continue;
				ans = min(ans, (h-tz+24)%24);
				cout << ans << endl;
			}
		}
		string ret = "";
		ret += '0' + ans/10;
		ret += '0' + ans%10;
		ret += ":";
		ret += time[3]=='?'?'0':time[3];
		ret += time[4]=='?'?'0':time[4];
		return ret;
	}
};
